package cn.mazexal.exambg.utils;

import org.springframework.beans.BeanUtils;

import java.util.List;

/**
 * @author: Mazexal
 * Date: 2022/3/12
 */
public class TransferUtil<T> {

    public void copyList(List source, List<T> target, Class<T> targetClassObj) {
        source.forEach(item -> {
            try {
                T data = targetClassObj.newInstance();
                BeanUtils.copyProperties(item, data);
                target.add(data);
            } catch (Exception e) {
                return;
            }
        });
    }

}
